import http from '.'

/**
 * 查询普通门卡信息(分页)
 * @param {*} params
 */
export function queryDoorCardHouse(params) {
  return http.get(
    'api/v1/card/doorCard/queryDoorCardHouse?' + Form(params).queryString()
  )
}

/**
 * 查询小区通卡信息(分页)
 * @param {*} params
 */
export function queryDoorCardComm(params) {
  return http.get(
    'api/v1/card/doorCard/queryDoorCardComm?' + Form(params).queryString()
  )
}

/**
 * 删除门卡信息
 * @param {*} rowId
 */
export function deleteDoorCard(rowId) {
  return http.post('api/v1/card/doorCard/delete?rowId=' + rowId)
}

/**
 * 注销门卡信息
 * @param {*} rowId
 */
export function cancelDoorCard(rowId) {
  return http.post('api/v1/card/doorCard/cancelDoorCard?rowId=' + rowId)
}
/**
 * 门卡授权或解除门卡授权
 * @param {*} rowId
 * @param {*} isWarrant
 */
export function grantDoorCard(rowId, isWarrant) {
  return http.post(
    'api/v1/card/doorCard/grantDoorCard?rowId=' +
      rowId +
      '&isWarrant=' +
      isWarrant
  )
}

/**
 * 挂失门卡信息
 * @param {*} rowId
 */
export function reportTheLoss(rowId) {
  return http.post('api/v1/card/doorCard/reportTheLoss?rowId=' + rowId)
}

/**
 * 激活门卡信息
 * @param {*} rowId
 */
export function activationDoorCard(rowId) {
  return http.post('api/v1/card/doorCard/activationDoorCard?rowId=' + rowId)
}

/**
 * 确认领取门禁卡
 */
export function receiveCard(rowId) {
  return http.post('api/v1/card/doorCard/receiveCard?rowId=' + rowId)
}

/**
 * 查询门卡批次信息(分页)
 * @param {*} params
 */
export function queryDoorCardBatch(params) {
  return http.get('api/v1/card/batch/query?' + Form(params).queryString())
}

/**
 * 删除门卡批次信息
 * @param {*} rowId
 */
export function deleteDoorCardBatch(rowId) {
  return http.post('api/v1/card/batch/delete?rowId=' + rowId)
}

/**
 * 获取批次、卡号
 */
export function queryBatchInfo() {
  return http.get('api/v1/card/batch/queryBatchInfo')
}

/**
 * 新增批次
 * @param {*} params
 */
export function addDoorCardBatch(params) {
  return http.post(
    'api/v1/card/batch/addDoorCardBatch?' + Form(params).queryString()
  )
}

/**
 * 修改批次状态
 * @param {*} params
 */
export function editDoorCardBatchStatus(params) {
  return http.post('api/v1/card/batch/edit?' + Form(params).queryString())
}

/**
 * 查询门卡类型(分页)
 * @param {*} params
 */
export function queryDoorCardType(params) {
  return http.get('api/v1/card/type/query?' + Form(params).queryString())
}

/**
 * 删除门卡类型
 * @param {*} rowId
 */
export function deleteDoorCardType(rowId) {
  return http.post('api/v1/card/type/delete?rowId=' + rowId)
}

/**
 * 新增门卡类型
 * @param {*} params
 */
export function addDoorCardType(params) {
  return http.post('api/v1/card/type/add?' + Form(params).queryString())
}

/**
 * 修改门卡类型信息
 * @param {*} params
 */
export function editDoorCardType(params) {
  return http.post('api/v1/card/type/edit?' + Form(params).queryString())
}
/**
 * 小区门卡关联
 */
export function queryCommunityDoor() {
  return http.get('api/v1/community/queryCommunity')
}

export function addCommunityDoor(params) {
  return http.post(
    'api/v1/card/doorCardCommunity/bindCommunity?' + Form(params).queryString()
  )
}

/**
 * 根据id查询所有小区已经绑定的通卡卡号
 * @param {*} communityId
 */
export function getAlreadGeneralCard(communityId) {
  return http.get(
    'api/v1/card/doorCardCommunity/getAlreadGeneralCard?communityId=' +
      communityId
  )
}

/**
 * 小区绑定门卡
 * @param {*} params
 */
export function bindAllGeneralCard(params) {
  return http.post(
    'api/v1/card/doorCardCommunity/bindAllGeneralCard?' +
      Form(params).queryString()
  )
}

/**
 * 删除小区绑定门卡
 * @param {*} params
 */
export function deleteGeneralCard(params) {
  return http.post(
    'api/v1/card/doorCardCommunity/deleteGeneralCard?' +
      Form(params).queryString()
  )
}

/**
 * 卡绑定室
 * @param {*} params
 */
export function bindHouse(params) {
  return http.post('api/v1/card/doorCard/bindHouse', Form(params))
}
/**
 * 批量激活门禁卡
 * @param {*}
 */
export function volumeActiveDoorCard(cardBatch) {
  return http.post(
    'api/v1/card/batch/volumeActiveDoorCard?cardBatch=' + cardBatch
  )
}
/**
 * 查询门卡操作日志
 * @param {*} params
 */
export function selectDoorCardOplog(params) {
  return http.get(
    'api/v1/log/doorCardOpLog/selectDoorCardOplog?' + Form(params).queryString()
  )
}
/**
 * 卡片被领取的用户信息
 * @param {*} rowId
 */
export function selectUserMessageByDoorCard(rowId) {
  return http.get(
    'api/v1/card/doorCard/selectUserMessageByDoorCard?rowId=' + rowId
  )
}
